-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI Switch - Dynamic properties #1227
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bartbutenaers thanks a lot for improvement of this widget
Dynamic properties are working as expected and the docs also looks good.
Screen.Recording.2024-08-26.at.11.09.20.mov
Overall PR looks good to me.
@joepavitt are we setting Passthru
as a dynamic property #1181. It's not implemented other widgets at the moment
@@ -113,7 +136,7 @@ export default { | |||
}, | |||
toggle () { | |||
if (this.state.enabled) { | |||
if (this.props.decouple) { | |||
if (this.getProperty('decouple')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to move this to a computed property and refer it here as a readability improvement. But we can do that later
computed: {
decouple () {
return this.getProperty('decouple')
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we setting Passthru as a dynamic property #1181. It's not implemented other widgets at the moment
It wasn't a priority in others, switch is used in different ways where having this would be useful. Not goign to push it away if it's already been implemented!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback Joe. I will check this separately
Hi @joepavitt, @joepavitt, |
Description
This PR allows the properties of a ui-switch to be dynamically updated via input messages:
msg.ui_update.label
msg.ui_update.passthru
msg.ui_update.decouple
msg.ui_update.oncolor
msg.ui_update.offcolor
msg.ui_update.onicon
msg.ui_update.officon
Example flow
TODO's
When I first saw the "Indicator" property in the config screen this week, I thought that it was only about the node status label. But it seems that there is a quite simple but powerfull mechanism involved behind the scenes. I really like the simplicity of the design! But it is not clear what this property is really doing, by simply looking at the config screen. So I suggest to update the documenation.
Moreover the property is named "Indicator" on the config screen. On the other hand, the corresponding node property is
decouple
. First at all I find it confusing that the dynamic property has a different name as in the config screen. Imho I would call it also 'Decouple' on the config screen, because it is in fact a decoupling mechanism.I think this is the summary:
But since I am not native english speaking you guys might perhaps have better descriptions for this...
Related Issue(s)
See #1181
Checklist
flowforge.yml
?FlowFuse/helm
to update ConfigMap TemplateFlowFuse/CloudProject
to update values for Staging/ProductionLabels
area:migration
label